﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Jxym.wlkc2011.Module.Default.model;
using Jxym.DBUtility;

namespace Jxym.wlkc2011.Module.Default.SERVER.User
{
    public partial class DepmetDel : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string returnJsonStr = "{'success':false,'msg':'参数错误'}";

                MsSqlDal<Depmet> iD = new MsSqlDal<Depmet>();

                int nodeId = 0; if (Request.Params["nodeId"] != null) { nodeId = Convert.ToInt32(Request.Params["nodeId"]); }

                if (nodeId != 0)
                {
                    try
                    {
                        int count = iD.Delete(nodeId.ToString());
                        returnJsonStr = "{'success':true,'msg':'删除" + count + "条数据'}";
                    }
                    catch
                    {
                        returnJsonStr = "{'success':false,'msg':'公司/部门已被[用户|职务]分配，无法删除'}";
                    }
                }
                Response.Write(returnJsonStr);
            }
        }
    }
}